home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
t_os
/
pigcc
/
pigcc.s
< prev
Wrap
Text File
|
1993-11-30
|
3KB
|
184 lines
/* Keta:NDW 1010:106 2010:210 10010:1041 100010:10384 1000010:103813 */
/* FDS=1:Display short FDS=0:Display full */
/* Magic number:4012754773 */
#define NDW 210
#define FDS 0
gcc_compiled.:
.text
LC0:
.ascii "Pi = %d.\12\0"
LC1:
.ascii "%09d\0"
LC2:
.ascii "\12\12start=%09d\12c_end=%09d\12d_end=%09d\12\0"
.align 2
.globl _main
_main:
pushl %ebp
movl %esp,%ebp
subl $8,%esp
pushl %edi
pushl %esi
pushl %ebx
call _clock
movl %eax,-4(%ebp)
cld
pushl %ebp
call _kyusu1
call _kyusu2
popl %ebp
call _clock
movl %eax,-8(%ebp)
pushl _a
pushl $LC0
call _printf
addl $4,%esp
movl $1000000000,%esi
movl $_a+4*NDW-4,%ebx
movl $0,(%esp)
std
L5:
call _mul_a
pushl %edx
pushl $LC1
call _printf
addl $8,%esp
cmpl $_a+4+4*NDW*FDS-36*FDS,%ebx
ja L5
call _clock
pushl %eax
pushl -8(%ebp)
pushl -4(%ebp)
pushl $LC2
call _printf
leal -20(%ebp),%esp
popl %ebx
popl %esi
popl %edi
leave
ret
.align 2
_mul_a:
addl $4012754773,4(%esp)
jnc L10
subl $4,%ebx
L10:
xorl %ecx,%ecx
movl %ebx,%edi
L12:
movl (%edi),%eax
mull %esi
addl %ecx,%eax
adcl $0,%edx
movl %edx,%ecx
stosl
cmpl $_a,%edi
jnz L12
ret
.align 2
_kyusu1:
subl $8,%esp
movl $NDW,(%esp)
movl $_a+4*NDW,4(%esp)
movl $25,%edi
movl $80,_a+4*NDW
movl $1,%ebx
L20:
call _div_add
addl $2,%ebx
call _div_sub
addl $2,%ebx
movl 4(%esp),%ecx
testl $-1,(%ecx)
jnz L20
addl $4,%ecx
decl (%esp)
movl %ecx,4(%esp)
cmpl $_a+8*NDW,%ecx
jb L20
addl $8,%esp
ret
.align 2
_kyusu2:
subl $8,%esp
movl $NDW,(%esp)
movl $_a+4*NDW,4(%esp)
movl $57121,%edi
movl $956,_a+4*NDW
movl $1,%ebx
L30:
call _div_sub
addl $2,%ebx
call _div_add
addl $2,%ebx
movl 4(%esp),%ecx
testl $-1,(%ecx)
jnz L30
addl $4,%ecx
decl (%esp)
movl %ecx,4(%esp)
cmpl $_a+8*NDW,%ecx
jb L30
addl $8,%esp
ret
.align 2
_div_add:
movl 4(%esp),%ecx
movl 8(%esp),%esi
xorl %edx,%edx
xorl %ebp,%ebp
L40:
lodsl
divl %edi
xchgl %edx,%ebp
movl %eax,-4(%esi)
divl %ebx
xchgl %edx,%ebp
addl %eax,-4*NDW-4(%esi)
adcl $0,-4*NDW-8(%esi)
jc L42
L41:
loop L40
ret
L42:
movl %esi,%eax
L43:
subl $4,%eax
addl $1,-4*NDW-8(%eax)
jc L43
jmp L41
.align 2
_div_sub:
movl 4(%esp),%ecx
movl 8(%esp),%esi
xorl %edx,%edx
xorl %ebp,%ebp
L50:
lodsl
divl %edi
xchgl %edx,%ebp
movl %eax,-4(%esi)
divl %ebx
xchgl %edx,%ebp
subl %eax,-4*NDW-4(%esi)
sbbl $0,-4*NDW-8(%esi)
jc L52
L51:
loop L50
ret
L52:
movl %esi,%eax
L53:
subl $4,%eax
subl $1,-4*NDW-8(%eax)
jc L53
jmp L51
.align 2
.comm _a,8*NDW